/**
 * 主题配置版本
 */ 
const Theme = new class Theme {
  constructor() {
    this._bigBColor = "#2284E7";
    this._bigBTextColor = "#3F9FFF";
    this._fffColor = "#fff";
  }

  JudgeUserTheme(theme, ...color) {
    theme = String(theme);
    let str = "";
    switch (theme) {
      case "bigB":
        str = color[0];
        break;
      default:
        str = color[0];
        break;
    }
    return str;
  }

  /**
   * 根据key返回 主题名称 
   */
  JudgeStyleToName(val) {
    val = String(val);
    switch(val) {
      case "0":
        return "终端"; 
      default:
        return "--";
    }
  }


  /**
   * 【默认】样式引入 
   */
  RequireBigBStyle() {
    require.ensure([],
      function() {
        require(`@/assets/theme/bigB/bigB.scss`);
      },
      'bigB'
    );
  }


  SetTheme(data) {
    let themeStr = "",
      dataStr = "";
    if (data instanceof Array) {
      if (data.length == 0) {
        dataStr = "";
      } else if (data.length == 1) {
        dataStr = data[0].toString();
      } else {
        dataStr = data.split(",")[0].toString();
      }
    } else {
      dataStr = String(data);
    }
    switch (dataStr) {
      case "0":
        themeStr = "bigB";
        this.RequireBigBStyle();
        // this.RequireBigBOnlineChatStyle();
        break;
      default:
        themeStr = "bigB";
        this.RequireBigBStyle();
        // this.RequireBigBOnlineChatStyle();
        break;
    }
    return themeStr;
  }

  // 颜色值
  judgeHostTheme(theme) {
    return this.JudgeUserTheme(theme,  this._bigBColor);
  }

  // 左侧栏颜色值
  judgeSideBarTheme(theme) {
    return this.JudgeUserTheme(theme,  this._bigBColor);
  }

  // phoneList的颜色
  judgeTimeShow(theme) {
    return this.JudgeUserTheme(
      theme,
      this._bigBTextColor,
    );
  }

  judgeMenuText(theme) {
    return this.JudgeUserTheme(theme, "#fff");
  }

  /**
   * 头部颜色值修改
   * @param theme 当前主题
   * @param defaultColor 原来颜色
   */

  judgeMenuActiveText(theme) {
    return this.JudgeUserTheme(theme, "#fff");
  }
}


export default Theme;
